package com.woniuxy.credit_loans.accounting_shi.service.impl;

import com.woniuxy.credit_loans.accounting_shi.service.ContractInfoService;
import com.woniuxy.credit_loans.accounting_shi.vo.WeiDaVo;
import com.woniuxy.credit_loans.entity.ContractInfo;
import com.woniuxy.credit_loans.mapper.ContractInfoMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class ContractInfoServiceImpl implements ContractInfoService {
    @Resource
    private ContractInfoMapper contractInfoMapper;

    @Override
    public WeiDaVo selectById(Long id) {
        return contractInfoMapper.selectById(id);
    }

    @Override
    public WeiDaVo selectByHeId(Long id) {
        return contractInfoMapper.selectByHeId(id);
    }

    @Override
    public List<WeiDaVo> selectAllById(String type) {
        return contractInfoMapper.selectAllById(type);
    }

    @Override
    public List<WeiDaVo> selectByName(String type, String name) {
        return contractInfoMapper.selectByName(type,name);
    }

    @Override
    public int insertSelective(ContractInfo record) {
        ContractInfo contractInfo = contractInfoMapper.selectByDiNumber(record.getDiNumber());
        if (contractInfo != null) {
            return 0;
        }
        return contractInfoMapper.insertSelective(record);
    }

    @Override
    public ContractInfo selectByDiNumber(String diNumber) {
        return contractInfoMapper.selectByDiNumber(diNumber);
    }

}
